Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ

Node / meshtastic / Meshtastic-Android / files / docs / en / developer / architecture.md

Displaying Raw β€’ View rendered β€’ Download

docs/en/developer/architecture.md 936be3998f0fe49f58b8a0f9ff2c01e3cbd85609 (936be399) Text, 4.94 KB

---
title: Architecture
parent: Developer Guide
nav_order: 1
last_updated: 2026-05-13
aliases:
Tff7b72- layers
Tff7b72- module-architecture
Tc9d1d9 - kmp
Tc9d1d9---

Tc9d1d9# Architecture

The Meshtastic Android/Desktop/iOS application follows a modular Kotlin Multiplatform (KMP) architecture with clear layer boundaries.

Tc9d1d9## Layer Overview

Ta5d6ff```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ androidApp / desktopApp β”‚ Platform entry points
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ feature/* modules β”‚ UI + Business Logic
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ core/* modules β”‚ Shared infrastructure
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Platform (Android/JVM/iOS) β”‚ OS-specific bindings
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

Tc9d1d9## Module Categories

Tc9d1d9### `androidApp/` β€” Android Application

The Android application entry point:
Tff7b72- Activity, Application, and Manifest definitions
Tff7b72- Koin DI module composition (Ta5d6ff`AppKoinModule`)
Tff7b72- Flavor-specific bindings (Ta5d6ff`google/`, Ta5d6ff`fdroid/`)
Tff7b72- Android-only integrations (widgets, services)

Tc9d1d9### `desktopApp/` β€” Desktop JVM Application

The Desktop (Linux/macOS/Windows) entry point:
Tff7b72- Compose Desktop window management
Tff7b72- Desktop-specific DI (Ta5d6ff`DesktopKoinModule`)
Tff7b72- Platform stubs for Android-only capabilities
Tff7b72- BLE (Kable), Serial, and TCP transport implementations

Tc9d1d9### `feature/*` β€” Feature Modules

Each Ta5d6ff`feature/` module owns a vertical slice of functionality:

| Module | Responsibility |
|--------|---------------|
| Ta5d6ff`feature:intro` | Onboarding/welcome flow |
| Ta5d6ff`feature:messaging` | Messages, channels, contacts, quick chat |
| Ta5d6ff`feature:connections` | Bluetooth/USB/TCP connection management |
| Ta5d6ff`feature:map` | Map display, waypoints |
| Ta5d6ff`feature:node` | Node list, node detail, metrics |
| Ta5d6ff`feature:settings` | All configuration screens |
| Ta5d6ff`feature:firmware` | Firmware update flow |
| Ta5d6ff`feature:docs` | In-app documentation browser |
| Ta5d6ff`feature:wifi-provision` | WiFi provisioning |
| Ta5d6ff`feature:widget` | Android home screen widgets |

Feature modules:
Tff7b72- Use the Ta5d6ff`meshtastic.kmp.feature` convention plugin
Tff7b72- Depend on Ta5d6ff`core` modules, never on other Ta5d6ff`feature` modules
Tff7b72- Own their navigation entries and DI registrations
Tff7b72- Contain platform-specific implementations in Ta5d6ff`androidMain`/Ta5d6ff`jvmMain`/Ta5d6ff`iosMain`

Tc9d1d9### `core/*` β€” Core Modules

Shared infrastructure used by all features:

| Module | Responsibility |
|--------|---------------|
| Ta5d6ff`core:common` | Utilities, extensions, build config |
| Ta5d6ff`core:navigation` | Routes, deep links, Navigation 3 |
| Ta5d6ff`core:ui` | Shared Compose components, icons, theme |
| Ta5d6ff`core:resources` | Shared string resources |
| Ta5d6ff`core:model` | Domain models |
| Ta5d6ff`core:data` | Data layer abstractions |
| Ta5d6ff`core:database` | Room KMP database |
| Ta5d6ff`core:datastore` | DataStore preferences |
| Ta5d6ff`core:prefs` | App preferences |
| Ta5d6ff`core:repository` | Repository interfaces |
| Ta5d6ff`core:service` | Mesh service layer |
| Ta5d6ff`core:di` | DI utilities |
| Ta5d6ff`core:network` | HTTP/serial/transport |
| Ta5d6ff`core:ble` | Bluetooth LE abstractions |
| Ta5d6ff`core:proto` | Protobuf definitions |
| Ta5d6ff`core:testing` | Test utilities |

Tc9d1d9## KMP Source Sets

Each module uses the standard KMP source set hierarchy:

Ta5d6ff```
src/
β”œβ”€β”€ commonMain/ ← Shared code (all platforms)
β”œβ”€β”€ commonTest/ ← Shared tests
β”œβ”€β”€ androidMain/ ← Android-specific
β”œβ”€β”€ jvmMain/ ← Desktop JVM-specific
β”œβ”€β”€ iosMain/ ← iOS-specific
└── jvmTest/ ← Desktop test host
```

**Golden Rules:**
Tff7b72- No Ta5d6ff`android.*` imports in Ta5d6ff`commonMain`
Tff7b72- Platform-specific code goes in appropriate source set
Tff7b72- Prefer interfaces + DI over Ta5d6ff`expect`/Ta5d6ff`actual` for complex behaviors
Tff7b72- Use Ta5d6ff`expect`/Ta5d6ff`actual` only for simple declarations

Tc9d1d9## Dependency Injection

The project uses **Koin** with annotation processing:
Tff7b72- Ta5d6ff`@Module`, Ta5d6ff`@Single`, Ta5d6ff`@Factory` annotations
Tff7b72- Ta5d6ff`@ComponentScan` for automatic registration
Tff7b72- Feature modules export their own Ta5d6ff`Feature*Module` class
Tff7b72- App/Desktop compose all modules in their root DI configuration

Tc9d1d9## Navigation

Navigation uses **Navigation 3** with typed routes:
Tff7b72- All routes defined in Ta5d6ff`core/navigation/Routes.kt`
Tff7b72- Routes are Ta5d6ff`@Serializable` data classes/objects
Tff7b72- Deep links resolved through Ta5d6ff`DeepLinkRouter`
Tff7b72- Each feature registers its own navigation entries

See [Tff7b72Navigation & Deep Links](Te6edf3navigation-and-deep-links) for details.

---

Served by rngit 1.5.2 - Generated in 0.06s